﻿using System.Web;

namespace Sex
{
    public partial class Sex : System.Web.UI.Page
    {
        public class ListApplication : MyList
        {
            HttpApplicationState a;
            string GetKeyList(string[] Keys)
            {
                string KeyList = "";
                foreach (string Key in Keys)
                {
                    KeyList += Key + " ";
                }
                return KeyList;
            }
            string GetStaticObjects()
            {
                string StaticObjects = "";
                HttpStaticObjectsCollection hsoc = a.StaticObjects;
                foreach (string Key in hsoc)
                {
                    StaticObjects += hsoc[StaticObjects] + " ";
                }
                return StaticObjects;
            }
            public ListApplication(State MyState)
                : base(MyState, "Application Object")
            {
                HttpContext myHttpContext = HttpContext.Current;
                a = myHttpContext.Application;
                a.Add(strDemoVariableName, strDemoEntry);
                string s = (string)a["Demo"];
                Add("Application.AllKeys", GetKeyList(a.AllKeys));
                foreach (string Key in a.AllKeys)
                {
                    string Value = (string)a.Get(Key);
                    s += FormatMyKey(Key) + FormatMyText("=") + Value + "<br/>";
                }
                Add("Application.AllKeys & Values", s);
                Add("Application.Count", a.Count.ToString());
                Add("Application.StaticObjects", GetStaticObjects());

                a = myHttpContext.Application;
            }
        }
    }
}